package ynu.czs.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import ynu.czs.pojo.Business;
import ynu.czs.pojo.Result;

@FeignClient(name = "business-service") // 替换为实际服务名
public interface BusinessFeignClient {

    @GetMapping("/business")
    Result list();

    @GetMapping("/business/search/{name}")
    Result search(@PathVariable("name") String name);

    @GetMapping("/business/orderTypeId/{orderTypeId}")
    Result getByOrderTypeId(@PathVariable("orderTypeId") Integer orderTypeId);

    @GetMapping("/business/businessId/{businessId}")
    Result getByBusinessId(@PathVariable("businessId") Integer businessId);

    @PostMapping("/business")
    Result add(@RequestBody Business business);

    @DeleteMapping("/business/{businessId}")
    Result delete(@PathVariable("businessId") Integer businessId);

    @GetMapping("/business/total/{businessId}/{userId}")
    Result total(@PathVariable("businessId") Integer businessId,
                 @PathVariable("userId") Long userId);

    @GetMapping("/business/quantity/{businessId}/{userId}")
    Result quantity(@PathVariable("businessId") Integer businessId,
                    @PathVariable("userId") Long userId);
}